﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Mukhopatro.BusinessEntities;

namespace Mukhopatro.BusinessLogicLayer
{
    public partial class CustomerNewsContentBLL
    {
        public List<CustomerNewsContent> GetCustomerNewsContent(int clientId)
        {
            return _socialShareDatabaseContext.CustomerNewsContents.Where(customerNewsContent => customerNewsContent.ClientId == clientId && customerNewsContent.IsActive).ToList();
        }

        public Int32 GetNewsContentsTotalCount(Func<CustomerNewsContent, bool> query)
        {
            try
            {
                //initialization
                return _socialShareDatabaseContext.CustomerNewsContents.Where(query).ToList().Count;
            }
            //handling other exceptions...
            catch (Exception ex)
            {
                //Error handling
                throw ex;
            }
        }

        public List<CustomerNewsContent> GetNewsContents(Func<CustomerNewsContent, bool> query, string orderBy, int startRowIndex = default(int), int maximumRows = default(int))
        {
            try
            {
                //CustomerContent
                List<CustomerNewsContent> result = _socialShareDatabaseContext.CustomerNewsContents.Where(query).Skip(startRowIndex).Take(maximumRows).ToList();
                return result;
            }
            //handling other exceptions...
            catch (Exception ex)
            {
                //Error handling
                throw ex;
            }
        }
    }
}